package com.varian.misc;

import cn.hutool.extra.spring.SpringUtil;
import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author ben
 * @since 2024/6/23
 */
@Data
@ConfigurationProperties(prefix = "varian")
public class VarianApplicationProperties implements InitializingBean {

    private String applicationName;

    private String port;

    private String localhost;

    private String version = "1.0.0";

    private String description = "Varian Wrynn, King of Stormwind, High King of the Alliance, and a warrior leader.";

    @Override
    public void afterPropertiesSet() throws Exception {
        this.applicationName = SpringUtil.getApplicationName();
        this.port = SpringUtil.getProperty("server.port");
        this.localhost = "localhost:" + port;
    }
}
